//
//  AICommonButton.m
//  UIKit
//
//  Created by Ailix on 15/3/6.
//  Copyright (c) 2015年 Ailix. All rights reserved.
//

#import "AICommonButton.h"


//#define kCommonButtonImageRatio .6
#define kCommonButtonTitleHeight 20.
//#define kCommonButtonMargin 7.5


@interface AICommonButton ()



@end

@implementation AICommonButton


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configContent];

    }
    return self;
}

- (void)awakeFromNib
{
    [self configContent];
}





- (void)configContent
{
//    NSLog(@"%@",self.titleLabel);
    self.imageView.contentMode = UIViewContentModeScaleAspectFit;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.titleLabel.font = [UIFont systemFontOfSize:13.];
    
}

#pragma mark 返回是按钮内部UILabel的边框
- (CGRect)titleRectForContentRect:(CGRect)contentRect
{

    CGRect titleRect = CGRectMake(0., contentRect.size.height - kCommonButtonTitleHeight - _padding, contentRect.size.width, kCommonButtonTitleHeight);
    return titleRect;
}

#pragma mark 返回是按钮内部UIImageView的边框
- (CGRect)imageRectForContentRect:(CGRect)contentRect
{

    CGRect imageRect = CGRectMake((self.frame.size.width - self.currentImage.size.width)/2., _padding, self.currentImage.size.width, self.currentImage.size.height);

    return imageRect;


}

@end
